package edu.hunau.cxb.pojo;

import com.fasterxml.jackson.annotation.*;

import java.time.LocalDate;

/**
 * @author hb
 * @create 2020-03-30 10:29
 */
//@JsonIgnoreType  表示当前类不参与json的处理
@JsonIgnoreProperties({"pwd"})  //指定当前类中哪些属性被json忽略
public class User {
    private Integer id;
    @JsonProperty("name")  //指定当前属性的名称
    private String username;
    //@JsonIgnore  //转成json时忽略该属性
    private String pwd;
    @JsonFormat(pattern="yyyy-MM-dd")
    private LocalDate doTime;

    public User(Integer id, String username, String pwd, LocalDate doTime) {
        this.id = id;
        this.username = username;
        this.pwd = pwd;
        this.doTime = doTime;
    }

    public LocalDate getDoTime() {
        return doTime;
    }

    public void setDoTime(LocalDate doTime) {
        this.doTime = doTime;
    }

    private Address address;

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public User() {
    }

    public User(Integer id, String username, String pwd) {
        this.id = id;
        this.username = username;
        this.pwd = pwd;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", pwd='" + pwd + '\'' +
                ", address=" + address +
                '}';
    }
}
